#ifndef PAGE2_H
#define PAGE2_H

#include <QWidget>
#include"qcustomplot/qcustomplot.h"

class CustomBars;
namespace Ui {
class Page2;
}

class Page2 : public QWidget
{
    Q_OBJECT

public:
    explicit Page2(QWidget *parent = nullptr);
    ~Page2();

private slots:
    void on_lockButton_clicked();

    void on_refreshButton_clicked();
    void getMesCheckRecord();

private:
    Ui::Page2 *ui;
    void initDraw();
    QCPTextElement *m_title;
    CustomBars *noPassBar,*passBar,*sumBar;

    int noPassCheck=0,noPassReCheck=0,noPassMaintain=0;
    int passCheck=0,passReCheck=0,passMaintain=0;
    int sumCheck=0,sumReCheck=0,sumMaintain=0;

    QTimer *refreshTimer=new QTimer(this);
    int hour;
};




// 头文件CustomBars.h
class CustomBars : public QCPBars
{
public:
    explicit CustomBars(QCPAxis *keyAxis, QCPAxis *valueAxis);

    Qt::Alignment textAligment() const { return mTextAlignment; }
    double spacing() const { return mSpacing; }
    QFont font() const { return mFont; }

    void setTextAlignment(Qt::Alignment alignment);
    void setSpacing(double spacing);
    void setFont(const QFont &font);

protected:
    Qt::Alignment mTextAlignment;   // 文字对齐方式
    double mSpacing;                // 文字与柱状图的间距，这里按像素大小
    QFont mFont=QFont("Microsoft Yahei", 9);                    // 文字使用的字体

    virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE;
};
#endif // PAGE2_H
